<template>
  <div class="pz_box" :class="styleOptions[activityConfig.content.style]">
    <div
      v-for="(item, index) in activityConfig.venueContent.customList"
      :key="index"
      class="pz_box_item mb3"
    >
      <img class="pzImg" :src="item.icon || item.poster">
      <template v-if="item.bean && item.bean.status">
        <div
          v-if="activityConfig.content.param.indexOf('4') > -1"
          class="hd_item_tag"
          :class="
            item.bean.status == 0 ||
              item.bean.status == 2 ||
              item.bean.status == 4 ||
              item.bean.status == 5
              ? 'hui'
              : item.bean.status == 1
                ? 'on'
                : item.bean.status == 3
                  ? 'blue'
                  : ''
          "
        >
          {{
            item.bean.status == 0
              ? translate("dfb")
              : item.bean.status == 1
                ? translate("bmz")
                : item.bean.status == 2
                  ? translate("bmyjz")
                  : item.bean.status == 3
                    ? translate("jxz")
                    : item.bean.status == 4
                      ? translate("hdjs")
                      : translate("yqx")
          }}
        </div>
        <div class="pz_box_item_box">
          <div class="name">{{ item.name || item.title }}</div>
          <div
            v-if="
              activityConfig.content.param.indexOf('1') > -1 &&
                styleOptions[activityConfig.content.style] !== 'zt'
            "
            class="bmNum"
          >
            {{ item.bean.numJoin }}{{ translate("rybm") }}
          </div>
          <div
            v-if="activityConfig.content.param.indexOf('2') > -1"
            class="overflowLine time"
          >
            {{ translate("hdsj") }}：{{ item.bean.time }}
          </div>
          <template v-if="item.bean && item.bean.price">
            <div
              v-if="activityConfig.content.param.indexOf('3') > -1"
              class="price"
              :class="item.bean.price > 0 ? 'secondColor' : 'freePrice'"
            >
              {{ item.bean.price > 0 ? translate("renminbi") : translate("free")
              }}<span v-if="item.bean.price > 0">{{ item.bean.price }}</span>
            </div>
          </template>
          <template v-else>
            <div
              v-if="activityConfig.content.param.indexOf('3') > -1"
              class="price"
              :class="item.price > 0 ? 'secondColor' : 'freePrice'"
            >
              {{ item.price > 0 ? translate("renminbi") : translate("free")
              }}<span v-if="item.price > 0">{{ item.price }}</span>
            </div>
          </template>
        </div>
      </template>
      <template v-else>
        <div
          v-if="activityConfig.content.param.indexOf('4') > -1"
          class="hd_item_tag"
          :class="
            item.status == 0 ||
              item.status == 2 ||
              item.status == 4 ||
              item.status == 5
              ? 'hui'
              : item.status == 1
                ? 'on'
                : item.status == 3
                  ? 'blue'
                  : ''
          "
        >
          {{
            item.status == 0
              ? translate("dfb")
              : item.status == 1
                ? translate("bmz")
                : item.status == 2
                  ? translate("bmyjz")
                  : item.status == 3
                    ? translate("jxz")
                    : item.status == 4
                      ? translate("hdjs")
                      : translate("yqx")
          }}
        </div>
        <div class="pz_box_item_box">
          <div class="name">{{ item.name || item.title }}</div>
          <div
            v-if="
              activityConfig.content.param.indexOf('1') > -1 &&
                styleOptions[activityConfig.content.style] !== 'zt'
            "
            class="bmNum"
          >
            {{ item.joinNum }}{{ translate("rybm") }}
          </div>
          <div
            v-if="activityConfig.content.param.indexOf('2') > -1"
            class="overflowLine time"
          >
            {{ translate("hdsj") }}：{{ item.startDate }} ~ {{ item.endDate }}
          </div>
          <template>
            <div
              v-if="activityConfig.content.param.indexOf('3') > -1"
              class="price"
              :class="item.price > 0 ? 'secondColor' : 'freePrice'"
            >
              {{ item.price > 0 ? translate("renminbi") : translate("free")
              }}<span v-if="item.price > 0">{{ item.price }}</span>
            </div>
          </template>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    config: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      activityConfig: {
        content: {},
        venueContent: {
          customList: []
        }
      },
      styleOptions: {
        '1': 'hd',
        '2': 'dt',
        '3': 'zt',
        '4': 'sx'
      }
    }
  },
  watch: {
    config(val) {
      this.activityConfig = this.config
    }
  }

}
</script>
<style lang="scss" scoped>
@import "@/styles/variables.scss";
.pz_box {
  .pzImg {
    vertical-align: top;
  }
  .pz_box_item {
    width: 100%;
    border-radius: 8px;
    position: relative;
    background-color: #fff;
    overflow: hidden;

    .hd_item_tag {
      position: absolute;
      top: 30px;
      left: 30px;
      padding: 5px 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: $Color;
      border-radius: 8px;
      font-size: 24px;
      font-weight: 500;
      color: #ffffff;

      &.hui {
        background: #999999;
      }

      &.on {
        background: $Color;
      }

      &.blue {
        background: $blueBg;
      }
    }

    .name {
      font-size: 30px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #222222;
      line-height: 1;
      margin-bottom: 5px;
    }
    .time {
      font-size: 24px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999999;
      margin-bottom: 20px;
    }
  }

  .price {
    font-size: 24px;
    line-height: 1;

    span {
      font-size: 32px;
      font-weight: bolder;
    }
  }

  &.dt {
    .pz_box_item {
      // border: 1px solid #E5E5E5;

      .pzImg {
        width: 100%;
        height: 388px;
      }

      .pz_box_item_box {
        position: static;
        box-sizing: border-box;
        padding: 20px;

        .bmNum {
          position: absolute;
          top: 218px;
          left: 20px;
          line-height: 42px;
          background: rgba(0, 0, 0, 0.6);
          border-radius: 22px;
          color: #fff;
          padding: 0 10px;
        }
      }
    }
  }
  &.hd {
    overflow: auto;
    width: 100%;
    display: flex;

    .pz_box_item {
      flex-shrink: 0;
      // border: 1px solid #E5E5E5;
      width: 440px;
      display: inline-block;
      margin-right: 30px;
      &:last-of-type {
        margin-right: 0;
      }

      .pzImg {
        width: 100%;
        height: 247px;
      }

      .pz_box_item_box {
        position: static;
        box-sizing: border-box;
        background-color: #fff;
        padding: 20px;

        .name {
          overflow: hidden;
          margin-bottom: 10px;
          text-overflow: ellipsis;
          display: -webkit-box;
          line-height: 40px;
          -webkit-line-clamp: 1;
          /* autoprefixer: off */
          -webkit-box-orient: vertical;
          /* autoprefixer: on */
        }

        .bmNum {
          font-size: 24px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #999999;
          margin-bottom: 10px;
        }
      }
    }
  }

  &.zt {
    .pz_box_item {
      display: flex;
      justify-content: space-between;
      background: none;

      .pzImg {
        width: 260px;
        border-radius: 8px;
        flex: none;
        height: 146px;
      }

      .pz_box_item_box {
        flex: 1;
        box-sizing: border-box;
        padding-left: 20px;
        position: static;

        .name {
          line-height: 1;
          margin-bottom: 20px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          /* autoprefixer: off */
          -webkit-box-orient: vertical;
          /* autoprefixer: on */
        }

        .bmNum {
          font-size: 24px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #999999;
          margin-bottom: 10px;
        }
      }
    }
  }
}
</style>
